package org.keyyond.ms.scheduler.service.impl;

import org.keyyond.ms.core.util.HttpUtil;
import org.keyyond.ms.scheduler.service.EcCorpDataSyncService;
import org.keyyond.ms.scheduler.util.EncryptUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

@Service
@RefreshScope
public class EcCorpDataSyncServiceImpl implements EcCorpDataSyncService{
	
	@Value("${authParam}")
	private String authParam;
	
	@Value("${esbPrefix}")
	private String esbPrefix;
	
	private static Logger logger = LoggerFactory.getLogger(MsEsbFeiYunSyncServiceImpl.class);
	
	@Override
	public String doSendOrganizationToEc(String relationApp) {
		// TODO Auto-generated method stub
		String param="{\"relationApp\":\""+relationApp+"\"}";
		String encrypt = EncryptUtil.encrypt2(authParam,param);
		String result=null;
		if(encrypt!=null){
			result=HttpUtil.sendPost(esbPrefix+"esb_org/sendOrganization", encrypt, "UTF-8");
		}else{
			logger.info("加密异常！");
		}
		return result;
		
	}

}